import 'package:flutter/material.dart';

import 'package:font_awesome_flutter/font_awesome_flutter.dart';

class ImageIconRoute extends StatefulWidget {
  const ImageIconRoute({Key? key}) : super(key: key);

  @override
  _ImageIconRouteState createState() => _ImageIconRouteState();
}

class _ImageIconRouteState extends State<ImageIconRoute> {
  @override
  Widget build(BuildContext context) {
    var img = AssetImage('assets/images/avatar.png');
    return Scaffold(
      appBar: AppBar(title: Text('图片和icon')),
      body: SingleChildScrollView(
        child: Column(
            children: <Image>[
          Image(
            image: img,
            height: 50,
            width: 100,
            fit: BoxFit.fill,
          ),
          Image(
            image: img,
            height: 50,
            width: 100,
            fit: BoxFit.contain,
          ),
          Image(
            image: img,
            height: 100,
            width: 50,
            fit: BoxFit.cover,
          ),
          Image(
            image: img,
            height: 100,
            width: 50,
            fit: BoxFit.fitHeight,
          ),
          Image(
            image: img,
            height: 100,
            width: 50,
            fit: BoxFit.scaleDown,
          ),
          Image(
              image: img,
              height: 100,
              color: Colors.lightBlue,
              colorBlendMode: BlendMode.difference,
              fit: BoxFit.fill),
          Image(
              image: img, height: 600, width: 200, repeat: ImageRepeat.repeatY),
        ].map((e) {
          return Row(
            children: <Widget>[
              Padding(
                padding: EdgeInsets.all(16),
                child: SizedBox(
                  width: 100,
                  child: e,
                ),
              )
            ],
          );
        }).toList()),
      ),
    );
  }
}

class IconFontRoute extends StatefulWidget {
  const IconFontRoute({Key? key}) : super(key: key);

  @override
  _IconFontRouteState createState() => _IconFontRouteState();
}

class _IconFontRouteState extends State<IconFontRoute> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          const Icon(Icons.add, color: Colors.blue),
          Text(
            '\uE287',
            style: const TextStyle(
              fontFamily: "MaterialIcons",
              fontSize: 24.0,
              color: Colors.green,
            ),
          ),
          showIcons()
        ],
      ),
    );
  }
}

Widget showIcons() {
  String icons1 = "";
  String icons2 = "";

  // accessible: 0xe03e
  icons1 += "\uE03e";
  // error:  0xe237
  icons1 += " \uE237";
  // fingerprint: 0xe287
  icons1 += " \uE287";

  return Column(
    children: [
      Text(
        icons1,
        style: const TextStyle(
          fontFamily: "MaterialIcons",
          fontSize: 24.0,
          color: Colors.green,
        ),
      ),
       Icon(IconFont.arrow_left,color: Colors.purple), 
       Icon(IconFont.arrow_right,color: Colors.purple), 

      Icon(FontAwesomeIcons.person,size: 30,color:Colors.red),
      Icon(FontAwesomeIcons.leaf,size: 30,color: Colors.orange,),

       Icon(AwaesomFont.phone,color: Colors.blue), 
       Icon(AwaesomFont.play,color: Colors.blue), 
    ],
  );
}


class IconFont{
  // book 图标
  static const IconData arrow_left = const IconData(
      0xe688, //不晓得这个是啥东西
      fontFamily: 'iconfont', 
      matchTextDirection: true
  );
  // 微信图标
  static const IconData arrow_right = const IconData(
      0xe687,  
      fontFamily: 'iconfont', 
      matchTextDirection: true
  );
}

class AwaesomFont{
  // book 图标
  static const IconData phone = const IconData(
      0xf879, //不晓得这个是啥东西
      fontFamily: 'Font Awesome 5 Pro', 
      matchTextDirection: true
  );
  // 微信图标
  static const IconData play = const IconData(
      0x1048,  
      fontFamily: 'Font Awesome 5 Pro', 
      matchTextDirection: true
  );
}